import useStorePinia from '@/store';

export default {
	mounted (el, binding) {
		const { user } = useStorePinia();
		const { value } = binding;
		const userPermissions = user.UserInfo.permissions; // 获取用户权限的方法
		if (!userPermissions.includes(value)) {
			el.parentNode && el.parentNode.removeChild(el);
		}
	},
};
export function checkPermission (permission) {
	const { user } = useStorePinia();
	const userPermissions = user.UserInfo.permissions;
	return userPermissions.includes(permission);
}
